package composite.collegeDisplay.component;

import composite.collegeDisplay.component.base.OrganizationComponent;

import java.util.ArrayList;

public class College extends OrganizationComponent {

    private ArrayList<OrganizationComponent> departments;

    public College(String name, String desc) {
        super(name, desc);
        departments = new ArrayList<OrganizationComponent>();
    }

    @Override
    public void add(OrganizationComponent organizationComponent) {
        departments.add(organizationComponent);
    }

    @Override
    public void remove(OrganizationComponent organizationComponent) {
        departments.remove(organizationComponent);
    }

    @Override
    public void print() {
        System.out.println("==="+ this.getName() +"===");
        for (OrganizationComponent organizationComponent : departments) {
            organizationComponent.print();
        }
    }

}
